
import Vue from "vue"

Vue.filter("rolename",(value)=>{
    if(!value) return value

    switch(value){
        case "1":
        return "普通居民";
        break;
        case "2":
        return "志愿者";
        break;
        case "3":
        return "管理员";
        break;
        case "4":
        return "超级管理员";
        break;
    }
})

Vue.filter("colorname",(value)=>{
    if(!value) return value

    switch(value){
        case "1":
        return "";
        break;
        case "2":
        return "success";
        break;
        case "3":
        return "warning";
        break;
        case "4":
        return "danger";
        break;
    }
})

Vue.filter("colortype",(value)=>{
    if(!value) return value;

    switch(value){
        case "1":
        return "success"
        break;
        case "2":
        return "warning"
        break;
        case "3":
        return "primary"
        break;
        case "4":
        return "danger"
        break;
        default:
        return ""
        break;
    }
})

import moment from "moment"

Vue.filter("timeFormat",(value,format)=>{
    if(!value) return value
    format = format || "MM-DD HH:mm:ss"
    return moment(value).format(format)
})